package com.example.dell.intelligentagriculture;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.RelativeLayout;

import com.example.dell.intelligentagriculture.utils.MyApp;

public class DataControlActivity extends AppCompatActivity implements View.OnClickListener {
    RelativeLayout item1, item2, item3, item4;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_data_control);
        initView();
    }

    private void initView() {
        MyApp myApp= (MyApp) getApplication();
        item1 = findViewById(R.id.item1);
        item2 = findViewById(R.id.item2);
        item3 = findViewById(R.id.item3);
        item4 = findViewById(R.id.item4);
        item1.setOnClickListener(this);
        item2.setOnClickListener(this);
        item3.setOnClickListener(this);
        item4.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.item1:
                intent.putExtra("ppounet", 10);
                intent.setClass(DataControlActivity.this, SetupActivity.class);
                break;
            case R.id.item2:
                intent.putExtra("ppounet", 11);
                intent.setClass(DataControlActivity.this, SetupActivity.class);
                break;
            case R.id.item3:
                intent.putExtra("ppounet", 12);
                intent.setClass(DataControlActivity.this, SetupActivity.class);
                break;
            case R.id.item4:
                intent.putExtra("ppounet", 13);
                intent.setClass(DataControlActivity.this, SetupActivity.class);
                break;
        }
        startActivity(intent);
    }
}
